package ssm.service.serviceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import ssm.dao.UserDao;
import ssm.pojo.UserSsm;
import ssm.service.UserService;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public Boolean addUser(UserSsm userssm) {
       return userDao.insert(userssm) >0 ? true:false;
    }

    @Override
    public Boolean deleteUserById(Integer id) {
        return userDao.deleteByUserId(id) > 0 ? true:false;
    }

    @Override
    public Boolean updateUser(UserSsm userssm) {
        System.out.println("修改service");
        return userDao.updateByUserId(userssm) >0 ? true:false;
    }

    @Override
    public UserSsm findUserById(Integer id) {
        UserSsm userssm = userDao.selectByUserId(id);
        return userssm;
    }

    @Override
    public List<UserSsm> findAll() {
        List<UserSsm> list = userDao.selectAll();
        return list;
    }
}
